import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn,
  UpdateDateColumn,
  ManyToOne,
  JoinColumn,
} from 'typeorm';
import { Users } from '../../users/entities/user.entity';

@Entity({ name: 'todo_reply' })
export class TodoReply {
  @PrimaryGeneratedColumn({ name: '_Identify' })
  _Identify: number;

  @Column({ name: 'todoid' })
  todoid: string;

  @CreateDateColumn({ name: 'replytime' })
  replytime: Date;

  @Column({ type: 'text', name: 'replycontent' })
  replycontent: string;

  @Column({ nullable: true, name: 'picture' })
  picture: string;

  @Column({ name: 'author', type: 'int' })
  author: number;

  @ManyToOne(() => Users, { eager: true })
  @JoinColumn({ name: 'author', referencedColumnName: 'id' })
  authorUser: Users;

  @UpdateDateColumn({ name: 'updatetime' })
  updatetime: Date;

  @Column({ name: 'todoreplyid', nullable: true })
  todoreplyid: string;

  @Column({ name: 'deleted', type: 'bit', default: false })
  deleted: boolean;
} 